home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _51AB5544BB6E4FF8A1C9FA441763D708 < prev    next >
Encoding:
Text File  |  2004-01-06  |  4.5 KB  |  160 lines

  1.  
  2. AIBehaviour.Car_path = {
  3.     Name = "Car_path",
  4.     
  5.  
  6.     -- SYSTEM EVENTS            -----
  7.     ---------------------------------------------
  8.     OnSpawn = function(self , entity )
  9.  
  10.     end,
  11.     ---------------------------------------------
  12.     OnActivate = function(self, entity )
  13.  
  14.     end,
  15.     ---------------------------------------------
  16.     ---------------------------------------------
  17.     OnGrenadeSeen = function(self, entity )
  18.  
  19. printf( "Vehicle -------------- OnGranateSeen" );    
  20.     
  21.         entity:InsertSubpipe(0,"c_grenade_run_away" );
  22.         
  23.     end,
  24.     ---------------------------------------------
  25.     ---------------------------------------------
  26.     OnGroupMemberDied = function( self,entity,sender )
  27. --do return end
  28. --printf( "Vehicle -------------- OnDeath" );    
  29.         if( sender == entity.driver ) then                -- stop if the driver is killed
  30.             AI:Signal( 0, 1, "DRIVER_OUT",entity.id);
  31.         end    
  32.     end,    
  33.  
  34.     ---------------------------------------------
  35.     OnEnemyMemory = function( self, entity )
  36. --printf( "Vehicle -------------- RejectPlayer" );    
  37.  
  38. --        entity:TriggerEvent(AIEVENT_REJECT);
  39.  
  40.     end,
  41.  
  42.     --------------------------------------------
  43.     OnPlayerSeen = function( self, entity, fDistance )
  44.  
  45. --printf( "Vehicle -------------- RejectPlayer" );    
  46.  
  47. --        entity:TriggerEvent(AIEVENT_REJECT);
  48.  
  49.     end,
  50.  
  51.     ---------------------------------------------
  52.     -- CUSTOM
  53.     ---------------------------------------------
  54.     ---------------------------------------------
  55.     VEHICLE_ARRIVED = function( self,entity, sender )
  56.         printf( "Vehicle is there" );
  57.         entity:SelectPipe(0,"v_brake");
  58.     end,
  59.  
  60.  
  61.     --------------------------------------------
  62.     DRIVER_IN = function( self,entity, sender )
  63.     
  64.         local pipeName = entity:GetName();
  65.         AI:CreateGoalPipe(pipeName);
  66.         AI:PushGoal(pipeName,"ignoreall",0,1);
  67.         AI:PushGoal(pipeName,"strafe",0,0);                        --stop breaking
  68.         AI:PushGoal(pipeName,"acqtarget",0,"");
  69.         if(entity.Properties.fApproachDist) then
  70.             AI:PushGoal(pipeName,"approach",1,entity.Properties.fApproachDist);
  71.         else    
  72.             AI:PushGoal(pipeName,"approach",1,20);
  73.         end    
  74.         AI:PushGoal(pipeName,"signal",0,1,"next_point",0);
  75.     
  76.         if( entity.Properties.pathstartAlter and entity.driverT.entity) then
  77.             if( entity.driverT.entity.Properties.special == 1 and entity.Properties.pathstartAlter>=0 ) then
  78.                 entity.Properties.pathname = entity.driverT.entity.Properties.pathname;
  79.                 entity.step = entity.Properties.pathstartAlter - 1;
  80.             end    
  81.         end
  82.             
  83.         AI:Signal( 0, 1, "next_point",entity.id);                    
  84. --entity:SelectPipe(0,"c_standingthere");        
  85.     end,    
  86.  
  87.     --------------------------------------------
  88.     GO_CHASE = function( self,entity, sender )
  89.  
  90.         entity.EventToCall = "DRIVER_IN";
  91.         
  92. --entity:SelectPipe(0,"c_standingthere");        
  93.         
  94.     end,    
  95.  
  96.     --------------------------------------------
  97.     BRING_REINFORCMENT = function( self,entity, sender )
  98.  
  99.         entity.EventToCall = "DRIVER_IN";
  100.         
  101. --entity:SelectPipe(0,"c_standingthere");        
  102.         
  103.     end,    
  104.  
  105.  
  106.     --------------------------------------------
  107.     EVERYONE_OUT = function( self,entity, sender )
  108.  
  109.         entity:SelectPipe(0,"c_brake");
  110. --        entity:EveryoneOut();    
  111.         VC.DropPeople( entity );
  112.         
  113. --        AI:Signal( 0, 1, "next_point",entity.id);                    
  114. --entity:SelectPipe(0,"c_standingthere");        
  115.         
  116.     end,    
  117.     
  118.  
  119.     
  120.     --------------------------------------------
  121.     next_point = function( self,entity, sender )    
  122.     
  123.         entity.step = entity.step + 1;
  124.         if( entity.step >= entity.Properties.pathsteps ) then
  125. --            entity.step = entity.Properties.pathstart;            
  126.             if( entity.Properties.bPathloop == 1 ) then
  127.                 entity.step = entity.Properties.pathstart;            
  128.             else    
  129.                 if(entity.Event_PathEnd) then
  130.                     entity:Event_PathEnd();
  131.                 end
  132. --                AI:Signal( 0, 1, "EVERYONE_OUT",entity.id);
  133.                 AI:Signal( 0, 1, "DRIVER_OUT",entity.id);
  134.             end    
  135.         end    
  136.         
  137.         printf( "---->>let's go!!  #%d [%d] loop=%d", entity.step, entity.Properties.pathsteps, entity.Properties.bPathloop );        
  138.         entity:SelectPipe(0,entity:GetName(), entity.Properties.pathname..entity.step);    
  139. --        entity:SelectPipe(0,"c_goto_ignore", entity.Properties.pathname..entity.step);
  140. --        entity:SelectPipe(0,"c_goto_path", entity.Properties.pathname..self.step);        
  141.  
  142.     end,
  143.  
  144.     ---------------------------------------------
  145.     DRIVER_OUT = function( self,entity,sender )
  146. --printf( "car patol  -------------- driver out" );    
  147.         entity:SelectPipe(0,"c_brake" );
  148.         entity:DropPeople();
  149.     end,    
  150.  
  151.     ---------------------------------------------
  152.     GUNNER_OUT = function( self,entity,sender )
  153. --printf( "car patol  -------------- driver out" );    
  154.         entity:SelectPipe(0,"c_brake" );
  155.         entity:DropPeople();
  156.     end,    
  157.  
  158.     
  159. }
  160.